﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ToolKit.Mvvm.Attributes
{
    /// <summary>
    /// 表示一个View视图，实现View与ViewModel的DataContext自动绑定
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public class ViewAttribute : Attribute
    {
        /*
         * 当view被标注为此特性后，在获取view的实例时，会到ViewModels目录下面寻找其ViewModel，并绑定到View的DataContext
         * 但view必须是FrameworkElement的子类，否则不予理睬
         */

        public string ViewName { get; }
        public ViewAttribute(string name = null)
        {
            ViewName = name;
        }
    }
}
